import { Routes, Route   } from 'react-router-dom'
import { useSelector } from 'react-redux'
export default function RouterView (){
    const routes = useSelector(state=>{
        return state.routerReducer.routes.filter(val=>!val.hidden)
    })
    return <>
    <Routes>
        {routes.map(item=>{
            return <Route path={item.path} key={item.path} Component={item.component}>
            {item.children?.length > 0 ? item.children.map(val=>{
              return <Route path={val.path} Component={val.component}></Route>
            }) :''}
          </Route>
        })}
    </Routes>
    </>
}